package com.chiancloud.shield.server.services.curator;

import com.google.common.collect.Lists;
import org.apache.curator.x.discovery.UriSpec;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;

import java.util.List;

/**
 * Created by wanghui on 14-8-20.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class CuratorUriSpec extends UriSpec {

    private final List<Part> parts = Lists.newArrayList();

    public CuratorUriSpec() {
        super();
    }

    @Override
    public List<Part> getParts() {
        return Lists.newArrayList(parts);
    }

    @Override
    public void add(Part part) {
        super.add(part);
        parts.add(part);
    }

    public void addAll(List<Part> parts) {
        parts.addAll(parts);
    }

    @Override
    public void remove(Part part) {
        super.remove(part);
        parts.remove(part);
    }
}
